package com.project.controller;

import com.project.bean.StudentBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {

    @RequestMapping("checkName")
    public String checkName(String username){
        if ("java".equals(username)){
            return "ok";
        }else {
            return "no";
        }
    }
    @RequestMapping("getList")
    public List<StudentBean> getList(){
        List<StudentBean> list = new ArrayList<>();
        list.add(new StudentBean(1,"刘某", LocalDate.parse("1997-02-25")));
        list.add(new StudentBean(2,"红旗", LocalDate.parse("1990-08-12")));
        list.add(new StudentBean(3,"八哥", LocalDate.parse("1993-06-13")));
        list.add(new StudentBean(5,"刘三", LocalDate.parse("1995-05-27")));

        return list;
    }


}
